#include<bits/stdc++.h>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const ll N = 1e6 + 10, INF = 0x3f3f3f3f;

ll q;
struct node
{
    ll x, c;
}a[N];
ll l = 1, r = 0;

void add(ll c, ll x)
{
    ++r;
    a[r].c = c;
    a[r].x = x;
}

ll erase(ll k)
{
    ll sum = 0;
    while (k) {
        if (a[l].c <= k) {
            sum += a[l].c * a[l].x;
            k -= a[l].c;
            l++;
        } else {
            sum += k * a[l].x;
            a[l].c -= k;
            k = 0;
        }
    }
    return sum;
}

void solve()
{
    cin >> q;

    while (q--) {
        ll op, c, x, k; cin >> op;
        if (op == 1) {
            cin >> c >> x;
            add(c, x);
        } else {
            cin >> k;
            cout << erase(k) << '\n';
        }
    }
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll T = 1;
    //cin>>T;
    for (ll i = 1;i <= T;i++) {
        solve();
    }
}